//
//  RegisterViewController.m
//  LClass
//
//  Created by 严军 on 16/5/30.
//  Copyright © 2016年 YanJun. All rights reserved.
//

#import "RegisterViewController.h"
#import "RegisterView.h"
#import "QQRequestManager+handle.h"
@interface RegisterViewController ()
{
    RegisterView* registeView;
}
@end

@implementation RegisterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navigationItem.title=@"注 册";
    self.navigationController.navigationBar.translucent = NO;
    self.navigationItem.leftItemsSupplementBackButton=NO;
    [self.navigationController.navigationBar setTitleTextAttributes:
     @{NSFontAttributeName:[UIFont boldSystemFontOfSize:16],
       
       NSForegroundColorAttributeName:[UIColor whiteColor]}];
    if (CurrentVersion <= 6.1) {
        self.navigationController.navigationBar.tintColor = [UIColor blackColor];
    } else {
        self.navigationController.navigationBar.barTintColor = [UIColor blackColor];
        self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    }
    
    self.navigationItem.leftBarButtonItem=({        
        UIBarButtonItem* tempBarButtonItem=[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"返回按钮"] style:UIBarButtonItemStyleDone target:self action:@selector(dissmissVC)];
        tempBarButtonItem.tintColor=[UIColor whiteColor];
        tempBarButtonItem.title=@"返回";
        tempBarButtonItem;
    });
    
    registeView=[[RegisterView alloc]init];
    self.view = registeView;
    
    __block RegisterViewController* blockSelf=self;
    
    registeView.registerblock=^(NSDictionary* parDic){
        
        [[QQRequestManager sharedRequestManager] GET_registerWithParameters:parDic success:^(NSURLSessionDataTask *task, id responseObject) {
            
            //注册成功跳转到登录页面
            [blockSelf.presentingViewController dismissViewControllerAnimated:YES completion:^{
                
            }];
            
        } failure:^(NSURLSessionDataTask *task, NSError *error) {
            
            //注册失败给出提示
        }];

    };

}




-(void)dissmissVC
{
    [self.presentingViewController dismissViewControllerAnimated:YES completion:^{
        
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
